package com.oss.controller.oss;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.oss.common.BaseResponse;
import com.oss.dto.oss.DeleteByIdDto;
import com.oss.dto.oss.investmentadvice.AddDto;
import com.oss.dto.oss.investmentadvice.PageDto;
import com.oss.dto.oss.investmentadvice.UpdateDto;
import com.oss.dto.oss.investmentadvice.WebQueryDto;
import com.oss.dto.oss.positionmanage.GetByIDDto;
import com.oss.service.oss.InvestmentAdviceService;
import com.oss.vo.oss.investmentadvice.InvestmentAdviceVO;
import com.oss.vo.oss.investmentadvice.WebInvestmentAdviceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;

/**
 * 投资建议
 */
@RestController
@RequestMapping("/investmentAdvice")
public class InvestmentAdviceController {
    @Autowired
    InvestmentAdviceService investmentAdviceService;
    @PostMapping("/getWebList")
    public BaseResponse<WebInvestmentAdviceVO> getWebList(@RequestBody @Valid WebQueryDto dto){
        return BaseResponse.success(investmentAdviceService.getWebList(dto));
    }
    @PostMapping("/selectByPage")
    public BaseResponse<IPage<InvestmentAdviceVO>> selectByPage(@RequestBody @Valid PageDto dto){
        return BaseResponse.success(investmentAdviceService.selectByPage(dto));
    }

    @PostMapping("/getByID")
    public BaseResponse getByID(@RequestBody @Valid GetByIDDto dto){
        return BaseResponse.success(investmentAdviceService.getByID(dto.getId()));
    }
    @PostMapping("/add")
    public BaseResponse<String> add(@RequestBody @Valid AddDto dto){
        return BaseResponse.success(investmentAdviceService.add(dto));
    }

    /**
     * 审批
     * @param dto
     * @return
     */
    @PostMapping("/approval")
    public BaseResponse<String> approval(@RequestBody @Valid UpdateDto dto){
        return BaseResponse.success(investmentAdviceService.approval(dto));
    }
    @PostMapping("/delete")
    public BaseResponse<String> delete(@RequestBody @Valid DeleteByIdDto dto){
        return BaseResponse.success(investmentAdviceService.delete(dto));
    }
}